package jsu.xxy.coffee3.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jsu.xxy.coffee3.domain.Gd;
import jsu.xxy.coffee3.domain.GdNoGid;
import jsu.xxy.coffee3.service.GdService;
import jsu.xxy.coffee3.mapper.GdMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author 张从轩
* @description 针对表【gd】的数据库操作Service实现
* @createDate 2023-06-05 22:33:13
*/
@Service
public class GdServiceImpl extends ServiceImpl<GdMapper, Gd>
    implements GdService{
    @Autowired
    GdMapper gdMapper;
    @Override
    public boolean addAll(List<GdNoGid> gds) {
        long p = gdMapper.selectCount(null);
        if(p == 0) {
            for(GdNoGid gd : gds){
                gdMapper.add(gd);
            }
            return true;
        }
        return false;
    }

    @Override
    public List<Gd> getGd() {
        return  gdMapper.selectList(null);
    }

    @Override
    public int deleteGd() {
        return gdMapper.delete(null);
    }
}




